fix(client): add missing Windows env vars to DEFAULT_INHERITED_ENV_VARS - #2043
fix(client): add missing Windows env vars to DEFAULT_INHERITED_ENV_VARS#2043ChrisJr404 wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: a379b7a The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client
@modelcontextprotocol/codemod
@modelcontextprotocol/core
@modelcontextprotocol/server
@modelcontextprotocol/server-legacy
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
|
I can confirm this issue caused troubles to starting executables from within a local stdio MCP server, such as PowerShell, GitHub CLI, and etc. Especially that PowerShell depends on @jspahrsummers and @anaisbetts, I found you made the decision to not include those environment vars in #36. Could you please give some attention to this fix? |
|
Rebased onto main. The only conflict was in stdio.test.ts from the import refactor and the new dispose/buffer tests — stdio.ts merged cleanly, all the new env vars are intact. daxian-dbw's confirmation about PowerShell/PATHEXT matches what we saw: without PATHEXT nothing native resolves. Ready for another look. |
8ebeb0d to
a379b7a
Compare
Closes #2037.
On Windows,
DEFAULT_INHERITED_ENV_VARSis missing a few variables that common dev tooling needs. The most impactful one isPATHEXT: without it,spawn('npm', ...)(andgit,python, anything else that ships as.cmd/.exe/.bat) fails withENOENTeven whenPATHis set, because Node has no extensions to try.Added to the win32 branch:
PATHEXT— extensions Windows treats as executable. Fix for thespawn npm ENOENTsymptom in the issue.COMSPEC— path tocmd.exe; needed byspawn({ shell: true })and anything that shells out.PROGRAMFILES(X86)andPROGRAMW6432— the other two Program Files paths. Tools that resolve install locations need at least one of these depending on whether the parent is 32-bit or 64-bit.WINDIR— used by some legacy tooling that doesn't acceptSYSTEMROOT.Also sorted the array so future additions are easier to eyeball.
Test
Added a small assertion in
stdio.test.tsthat pins the expected list per platform, so a regression on either branch fails locally.pnpm testis green (365/365) andpnpm lint/pnpm typecheckare clean.Changeset included as a patch bump on
@modelcontextprotocol/client.